<script>
$(document).ready(function(){
	$(".error-inner").each(function(){
		if($(this).html() == '') {
			$(this).css("visibility", "hidden");
			$(this).siblings(".error-left").css("visibility", "hidden");
		}
	});
		
 	
});
	$(document).ready(function(){		
	 	$('form[name="addConfig"]').validate({
	    	rules: {
				key: { required: true },
				myValue: { required: true},				
			},
			errorPlacement: function(error, element){		        
		        $(element).parent().next().children(".error-inner").html(error);				
			},
			//errorClass: "",
			highlight: function(element, errorClass) {
				$(element).parent().next().children(".error-left, .error-inner").css("visibility", "visible");
				$(element).removeClass("inp-form");
				$(element).addClass("inp-form-error");
			},
			unhighlight: function(element, errorClass) {
				$(element).parent().next().children(".error-left, .error-inner").css("visibility", "hidden");
				$(element).removeClass("inp-form-error");
				$(element).addClass("inp-form");
			},
		    
		});
	});
</script>
<form name="addConfig" method="post" action="" enctype="multipart/form-data" onsubmit="return checkInput();">
	<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
    
			<tr>

			<th valign="top">Key:</th>

			<td><textarea rows="" name="key" cols="" class="inp-form"></textarea></td>

			<td>
			<div class="error-left"></div>
			<div class="error-inner"></div>
			</td>

		</tr>
			
			<tr>

			<th valign="top">Value:</th>

			<td><textarea rows="" name="myValue" cols="" class="form-textarea"></textarea></td>

			<td>
			<div class="error-left"></div>
			<div class="error-inner"></div>
			</td>

		</tr>
		<tr>

			<th>&nbsp;</th>

			<td valign="top">

				<input name ="submit" type="submit" value="" class="form-submit" />

				<input name ="reset" type="reset" value="" class="form-reset"  />

			</td>

			<td></td>

		</tr>

		</table>
</form>
